﻿using System;
using System.Globalization;

namespace net.entity.framework.common {
    public static class ConvertExtender {
        public static bool ToBoolean(this object obj)
        {
            return Convert.ToBoolean(obj);
        }
        public static Int32 ToInt32(this object obj) {
            return Convert.ToInt32(obj);
        }

        public static double ToDouble(this object obj) {
            return Convert.ToDouble(obj);
        }

        public static decimal ToDecimal(this object obj) {
            return Convert.ToDecimal(obj);
        }

        public static DateTime ToDateTime(this object obj) {
            return Convert.ToDateTime(obj);
        }

        public static DateTime ToDateTime(this object obj, string format) {
            return DateTime.ParseExact(obj.ToString(), format, DateTimeFormatInfo.InvariantInfo);
        }
    }
}